package com.mcxx.modules.miniSalvation.order.param;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;


@Data
public class OrderBizStateParam  implements Serializable {

    private String orderId;

    private List<String> orderIdList;

    private String bizStateType;

    private String gtEqBizState;

    private String ltEqBizState;

    private String notEqBizState;

    private String eqBizState;

    private String inBizStates;

    public OrderBizStateParam(){}
    public OrderBizStateParam(String orderId, List<String> orderIdList,String bizStateType){
        this.orderId = orderId;
        this.orderIdList = orderIdList;
        this.bizStateType = bizStateType;
    }
    public OrderBizStateParam(String bizStateType){
        this.bizStateType = bizStateType;
    }
    public OrderBizStateParam(List<String> orderIdList, String bizStateType){
        this.orderIdList = orderIdList;
        this.bizStateType = bizStateType;
    }

    public void setValue(String gtEqBizState, String ltEqBizState, String notEqBizState, String eqBizState){
        this.gtEqBizState = gtEqBizState;
        this.ltEqBizState = ltEqBizState;
        this.notEqBizState = notEqBizState;
        this.eqBizState = eqBizState;
    }


    public void setBizStateForIn(String... paramStatus){
        StringBuffer sb = new StringBuffer();
        for (String str : paramStatus) {

            if (StringUtils.isNotBlank(str)) {
                sb.append("'").append(str).append("',");
            }
        }
        String status = sb.toString();
        if(StringUtils.isNotBlank(status)){
            status = status.substring(0,status.length()-1);
            this.inBizStates = status;
        }
    }
}
